import fetch from 'common/src/utils/fetch'

/**
 * 查询申请列表
 */
export function selectApproFlowList(data) {
  return fetch({
    url: '/api/workflow/approval/selectApproFlowList',
    method: 'post',
    data
  });
}

/**
 * 管理员查询需审批的任务
 */
export function getMyApprovalTask(data) {
  return fetch({
    url: '/api/workflow/approval/getMyApprovalTask',
    method: 'post',
    data
  });
}

export function selectTaskList(data) {
  return fetch({
    url: '/api/workflow/approval/needApprovalTask',
    method: 'post',
    data
  });
}
// 培养方案审批列表 
export function approvalTaskList(data) {
  return fetch({
    url: '/api/workflow/approval/getMyApprovalTask',
    method: 'post',
    data
  });
}

/**
 * 查询已经审批的任务
 */
export function getApprovedTaskList(data) {
  return fetch({
    url: '/api/workflow/approval/getApprovalHistoryTask',
    method: 'post',
    data
  });
}


/**
 * 查询申请详情
 */
export function selectApproFlow(id) {
  return fetch({
    url: '/api/workflow/approval/selectApproFlow',
    method: 'get',
    params: {
      no: id
    }
  });
}


/**
 * 已审批和未审批 审批详情接口
 */
export function approvelDetail(params) {
  return fetch({
    url: '/api/workflow/approval/selectApproFlow',
    method: 'get',
    params: params
  });
}

/**
 * 通过申请
 */
export function approvalThrough(data) {
  return fetch({
    url: '/api/workflow/approval/through',
    method: 'post',
    data
  });
}

/**
 * 驳回申请
 */
export function approvalReject(data) {
  return fetch({
    url: '/api/workflow/approval/reject',
    method: 'post',
    data
  });
}

/**
 * 管理员查询需审批的任务
 */
export function selectTaskListPage(data) {
  return fetch({
    url: '/api/workflow/approval/page',
    method: 'post',
    data
  });
}

/**
 * 撤回的接口，内部进行调用工作流，并将原来的状态更改为草稿中
 * @param {} data 
 */
export function recall(data) {
  return fetch({
      url: '/api/workflow/approval/recall',
      method: 'post',
      data: data
  });
}
